package com.iot.modbus.execute.config;

import com.serotonin.modbus4j.ip.IpParameters;

import java.util.List;
import java.util.Objects;

/**
 * 设备相关配置
 */
public class DeviceDataConfig {

    /**
     * 设备id
     */
    private String deviceId;

    /**
     * 设备名称
     */
    private String deviceName;


    /**
     * modbus的ip参数
     */
    private IpParameters ipParameters;


    /**
     * 参数配置
     */
    private List<MetricDataConfig> metricDataConfigs;

    /**
     * 周期
     */
    private Long delay;

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    public IpParameters getIpParameters() {
        return ipParameters;
    }

    public void setIpParameters(IpParameters ipParameters) {
        this.ipParameters = ipParameters;
    }

    public List<MetricDataConfig> getMetricDataConfigs() {
        return metricDataConfigs;
    }

    public void setMetricDataConfigs(List<MetricDataConfig> metricDataConfigs) {
        this.metricDataConfigs = metricDataConfigs;
    }

    public Long getDelay() {
        return delay;
    }

    public void setDelay(Long delay) {
        this.delay = delay;
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        DeviceDataConfig that = (DeviceDataConfig) o;
        return Objects.equals(deviceId, that.deviceId) && Objects.equals(deviceName, that.deviceName) && Objects.equals(ipParameters, that.ipParameters) && Objects.equals(metricDataConfigs, that.metricDataConfigs) && Objects.equals(delay, that.delay);
    }

    @Override
    public int hashCode() {
        return Objects.hash(deviceId, deviceName, ipParameters, metricDataConfigs, delay);
    }

    @Override
    public String toString() {
        return "DeviceDataConfig{" +
                "deviceId='" + deviceId + '\'' +
                ", deviceName='" + deviceName + '\'' +
                ", ipParameters=" + ipParameters +
                ", metricDataConfigs=" + metricDataConfigs +
                ", delay=" + delay +
                '}';
    }
}
